﻿<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://xmlns.jcp.org/jsf/html"
        xmlns:f="http://xmlns.jcp.org/jsf/core"
        xmlns:cc="http://xmlns.jcp.org/jsf/composite"
        xmlns:ui="http://xmlns.jcp.org/jsf/facelets">

<cc:interface componentType="at.irian.CollapsiblePanel">
    <cc:attribute name="collapsed"/>
    <cc:actionSource name="toggle"/>
    <cc:facet name="header"/>
</cc:interface>

<cc:implementation>
    <h:panelGroup layout="block" styleClass="collapsiblePanel-header">
        <h:commandButton id="toggle" actionListener="#{cc.toggle}" styleClass="collapsiblePanel-img"
                image="#{resource[cc.collapsed ? 'mygourmet:toggle-plus.png' : 'mygourmet:toggle-minus.png']}">
            <f:ajax render="@this panel-content"/>
        </h:commandButton>
        <cc:renderFacet name="header"/>
    </h:panelGroup>
    <h:panelGroup id="panel-content" layout="block">
        <h:panelGroup rendered="#{!cc.collapsed}">
            <cc:insertChildren/>
        </h:panelGroup>
    </h:panelGroup>
</cc:implementation>

</ui:composition>